if (typeof jQuery !== 'undefined') {
	(function($) {
		
		$('#spinner').ajaxStart(function() {
			$(this).fadeIn();
		}).ajaxStop(function() {
			$(this).fadeOut();
		});
	})(jQuery);
}

$(function() {
	setInterval(function() {
		$.ajax({
			  url: '/book-loan/loanHistory/availableBook',
			  success: function(data) {
			  	  if(data || data != ''){
					$('#newsOutput').fadeOut('slow', function() {
				        });
				  	$('#newsOutput').html('<b>Latest News: ' + data + '</b>');
				  	$('#newsOutput').fadeIn('slow', function() {
				        });
				  } else{
					  $('#newsOutput').html('Latest News: N/A');
				  }
				}
			});
	},3000); //5 seconds	
});
